
package com.gitee.jmash.oidc.oauth2.models;

import jakarta.json.bind.annotation.JsonbProperty;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.Response.Status;

/**
 * OAuth2 Error Response.
 *
 * @author CGD
 *
 */
public class ErrorResponse {

  @JsonbProperty("error")
  private String error;

  @JsonbProperty("error_description")
  private String errorDescription;

  @JsonbProperty("error_uri")
  private String errorUri;

  public static Response createResponse(String error, String errorDescription) {
    ErrorResponse resp = new ErrorResponse(error, errorDescription);
    return Response.status(Status.BAD_REQUEST.getStatusCode()).entity(resp).build();
  }

  public ErrorResponse() {
    super();
  }

  /** OAuth2 Error Response. */
  public ErrorResponse(String error, String errorDescription) {
    super();
    this.error = error;
    this.errorDescription = errorDescription;
  }

  public String getError() {
    return error;
  }

  public void setError(String error) {
    this.error = error;
  }

  public String getErrorDescription() {
    return errorDescription;
  }

  public void setErrorDescription(String errorDescription) {
    this.errorDescription = errorDescription;
  }

  public String getErrorUri() {
    return errorUri;
  }

  public void setErrorUri(String errorUri) {
    this.errorUri = errorUri;
  }

}
